import React from 'react';
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
import Login from 'src/views/login/Login';
import AdminLayout from '../admin/layout/AdminLayout';
import Error404 from '../error/Error404';
import Error500 from '../error/Error500';
import UserLayout from '../user/layout/UserLayout';

class App extends React.Component {
  render() {
    return (
      <BrowserRouter>
        <Switch>
          <Route exact path="/" component={Login}/>
          <Route path="/login" component={Login}/>
          {/* canshu和aa是要传递的两个参数对应的名词*/}
          {/* <Route path="/login/:user/:pass" component={Login}/>*/}
          <Route path="/admin" component={AdminLayout}/>
          <Route path="/user" component={UserLayout}/>
          <Route exact path="/error/404" component={Error404}/>
          <Route exact path="/error/500" component={Error500}/>
          <Redirect to="/error/404"/>
        </Switch>
      </BrowserRouter>
    );
  }
}

export default App;
